home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / util4 / 0utils.lha / 0Utils / CDR.data < prev    next >
Text File  |  1995-09-05  |  2KB  |  84 lines

  1.  
  2. #ifdef TPLTER
  3.  
  4. CDR = {
  5.     NoParsing;
  6.     Version = "1.0";
  7.     Short = {{ Remove the first from a list of Words }};
  8.  
  9.     description = {{
  10.     Get all but the first word in a list of words.
  11.  
  12.     CAR and CDR build a pair that is in most cases
  13.     used together.
  14.     }};
  15.     Notes = {{
  16.     We currently do ignore ReadArgs, so do not expext
  17.     "CDR ?" to work.
  18.     }};
  19.  
  20.     Template = "/A/F";
  21.     Arguments = {{
  22.     STRPTR line;
  23. #    define CDR 1
  24.     }};
  25.  
  26.     History = {{
  27.     16-04-95 b_noll created
  28.     19-08-95 b_noll created .data file
  29.     19-08-95 b_noll (1.1) added newline output to CAR branch
  30.     }};
  31.     Body = {{
  32.     STRPTR sline, rline, line;
  33.     line = GetArgStr();
  34.     if (line) {
  35.         sline = rline = line;
  36.         while (*line == ' ') line++;
  37.         if (*line && (*line != '\n')) {
  38.         UBYTE buffer[MAXLINELEN];
  39.  
  40.         if (*line == '"') {
  41.             /* ---- closing quote */
  42.             ++line;
  43.             while (*line && (*line != '"'))
  44.             if (*(line++) == '*')
  45.                 if (*line)
  46.                 line++;
  47.         } else {
  48.             /* ---- end of first word */
  49.             while (*line && (*line != ' '))
  50.             line++;
  51.         } /* if */
  52.  
  53. #        if $(@isequal@CDR@$(CMD))
  54.             /* ---- Start of next word */
  55.             while (*line && (*line == ' '))
  56.             line++;
  57.  
  58.             PutStr ((*line) ? line : "\n");
  59.             retval = *line ? RETURN_OK : RETURN_WARN;
  60. #        else
  61.         {
  62.             UBYTE ch;
  63.             ch       = *line;
  64.             *line  = 0;
  65.             PutStr (sline);
  66.             PutStr ("\n");
  67.             *line  = ch;
  68.             retval = ch ? RETURN_OK : RETURN_WARN;
  69.         }
  70. #        endif
  71.         } else {
  72.         retval = RETURN_ERROR;
  73.         SetIoErr(ERROR_REQUIRED_ARG_MISSING);
  74.         } /* if */
  75.     } /* if */
  76.     }};
  77.     Addes = {{
  78. #define CDR 1
  79.     }};
  80. };
  81.  
  82. #endif
  83.  
  84.